package me.winds.infrared;

import android.app.Application;

import com.easyder.wrapper.ManagerConfig;
import com.squareup.leakcanary.LeakCanary;
import com.squareup.leakcanary.RefWatcher;
import com.tencent.bugly.Bugly;

/**
 * Auther:  winds
 * Data:    2018/2/27
 * Desc:
 */
public class WrapperApplication extends Application {

    private static Application instance;
    private static RefWatcher watcher;

    @Override
    public void onCreate() {
        super.onCreate();
        if (LeakCanary.isInAnalyzerProcess(this)) {
            return;
        }
        watcher = LeakCanary.install(this);

        instance = this;
        //初始wrapper包的manager
        ManagerConfig.getInstance().init(this)
                .setBaseHost(ApiConfig.HOST)
                .initHttpClient()
                .providRefWatcher(watcher)
                .setLogConfig(AppConfig.DEFAULT_LOG_PATH, BuildConfig.DEBUG, false);
        Bugly.init(instance, AppConfig.KEY_BUGLY, BuildConfig.DEBUG);
    }

    public static Application getInstance() {
        return instance;
    }
}
